<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>案例练习</title>
	</head>
	<body>
		<div id="app">
			<!--添加功能-->
			请输入数字A<input type="text" v-model="num1"><br>
			请输入数字B<input type="text" v-model="num2" @keyup.enter="add">
			<br>
			<button @click="add">计算</button>
			总和：<span v-text="sum"/>0
			
		</div>
		
		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<script>
            const app = new Vue({
                el: '#app',
                data: {
                    num1:'',
                    num2:'',
	                sum:''
                },
	            methods:{
                    add() {
                        this.sum=parseInt(this.num1)+parseInt(this.num2)
                    }
                }
            })
		</script>
	</body>
</html>